package com.jungle.mvvm.sample.http;

import com.jungle.mvvm.net.BaseNetwork;
import com.trello.rxlifecycle2.LifecycleProvider;

import io.reactivex.ObservableTransformer;
import io.reactivex.Observer;

/**
 * 详细说明
 *
 * @author Daniel
 * @version V1.0
 * @date 2021/1/20 10:12
 */
public class UpdateNetwork extends BaseNetwork {
    private UpdateNetwork() {
    }

    private static UpdateNetwork getInstance() {
        return Holder.INSTANCE;
    }

    private static class Holder {
        private final static UpdateNetwork INSTANCE = new UpdateNetwork();
    }

    public static <T> T getService(Class<T> service) {
        return getInstance().getRetrofit(service).create(service);
    }

    public static <T> ObservableTransformer<T, T> applyService(LifecycleProvider lifecycleProvider, Observer<T> observer) {
        return getInstance().applySchedulers(lifecycleProvider, observer);
    }

    @Override
    public String getDev() {
        return "https://app.gaj.nanning.gov.cn/NNMobileService/";
    }

    @Override
    public String getTest() {
        return "https://www.wanandroid.com/test/";
    }

    @Override
    public String getProd() {
        return "https://www.wanandroid.com/prod/";
    }
}
